package com.guinea.core.service;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.guinea.core.orm.Page;
import com.guinea.core.orm.hibernate.HibernateDao;

public abstract class CRUDManager {
	protected Logger logger = LoggerFactory.getLogger(getClass());
//	private HibernateDao entityDao;

	/**重载的Manager中不可使用该方法
	 * @return
	 */
	public abstract HibernateDao getEntityDao();

//	public void setEntityDao(HibernateDao entityDao) {
//		this.entityDao = entityDao;
//	}
	public Object get(Serializable id){
		return getEntityDao().get(id);
	}
	public List getAll(){
		return getEntityDao().getAll();
	}
	public List getValid(){
		return getEntityDao().getValid();
	}
	public void save(Object entity){
		getEntityDao().save(entity);
	}
//	//标记删除
//	public void erase(Object entity){
//		getEntityDao().erase(entity);
//	}
	public void delete(Object entity){
		getEntityDao().delete(entity);
	}
	public Page findPage(final Page page, final List filters) {
		return getEntityDao().findPage(page, filters);
	}
	public List find( final List filters) {
		return getEntityDao().find(filters);
	}

}
